Manages the raster states available in the component. More...
Public Member Functions | |
~RasterStateManager () | |
RasterState * | createOrRetrieve (const std::string_view &name) |
RasterState * | get (const std::string_view &name) |
RasterState * | getByIndex (unsigned int index) |
void | rename (const std::string_view &oldName, const std::string_view &newName) |
void | erase (const std::string_view &name) |
RasterState * | getDefaultState () const |
Manages the raster states available in the component.
The manager owns the memory it allocates. External code should never free memory returned.
nkGraphics::RasterStateManager::~RasterStateManager | ( | ) |
Destructor.
RasterState* nkGraphics::RasterStateManager::createOrRetrieve | ( | const std::string_view & | name | ) |
Creates if unavailable, or retrieves if available, a state.
name | The name of the state to retrieve. |
RasterState* nkGraphics::RasterStateManager::get | ( | const std::string_view & | name | ) |
Retrieves a state.
name | The name of the state to retrieve. |
RasterState* nkGraphics::RasterStateManager::getByIndex | ( | unsigned int | index | ) |
Retrieves a state by index. Note that an index can map to different states as the internal memory is changed. Mainly used for looping over all states in one go.
index | The index of the state to retrieve. |
void nkGraphics::RasterStateManager::rename | ( | const std::string_view & | oldName, |
const std::string_view & | newName | ||
) |
Renames a state, changing both its name and the way to address it in the manager.
oldName | The name of the state to rename. |
newName | The new name to attach to it. |
void nkGraphics::RasterStateManager::erase | ( | const std::string_view & | name | ) |
Erases and frees the memory allocated for a state.
name | The name of the state to erase. |
RasterState* nkGraphics::RasterStateManager::getDefaultState | ( | ) | const |